package com.shareppy.norman.entity;

import org.json.JSONObject;

import com.shareppy.norman.conversion.EntityJsonConverter;
import com.shareppy.norman.core.entity.AbstractEntity;


@SuppressWarnings("serial")
public class JsonEntity  extends AbstractEntity {

	public JSONObject toJSon() {
		try {
			return new EntityJsonConverter<AbstractEntity>().convert(this);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public String toString() {
		JSONObject jSon = toJSon();
		if (jSon == null) {
			return null;
		}
		return jSon.toString();
	}
}